<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns:cc="http://java.sun.com/jsf/composite"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:p="http://primefaces.org/ui"
       xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="bill" />
        <cc:attribute name="billController" />
        <cc:attribute name="dup" />
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>

        <div >

            <div >
                <div >
                    <h:form> 

                        <h:outputStylesheet name="printing.css" library="css" />

                        <p:commandButton value="Print" ajax="false" action="#" >
                            <p:printer target="gpBillPreview" ></p:printer>
                        </p:commandButton>

                        <div  >

                            <p:panel   id="gpBillPreview"   >

                                <div >
                                    <div>


                                        <div class="fiveinchbill" style="font-size: 130%;">
                                            <div  >

                                                <div style="position: absolute!important;left: 60%!important; font-weight: bold!important;
                                                     top: 0%!important;font-size: 14px!important; text-decoration: underline!important;">
                                                    <h:outputLabel value="Income Invoice"   />                            
                                                </div>

                                                <div style="position: absolute;
                                                     left: 0%!important;
                                                     top: 7%!important;
                                                     font-size: 12px!important;">
                                                    <h:outputLabel value="Receipt No"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 23%;
                                                     top: 7%;
                                                     font-size:12px!important;">
                                                    <h:outputLabel value=":"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 25%!important;
                                                     top: 7%!important;
                                                     font-size: 12px!important;">                                                  
                                                    <h:outputLabel value="#{cc.attrs.bill.cancelledBill.insId} **Cancelled"  
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId ne null}"/> 
                                                    <h:outputLabel value="#{cc.attrs.bill.insId}" 
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId eq null}"/>  
                                                    <h:outputLabel value="  **Duplicate" 
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId eq null and cc.attrs.dup eq true }" />
                                                </div>

                                                <div style="position: absolute;
                                                     left: 73%!important;
                                                     top: 7%!important;
                                                     font-size: 12px!important;">
                                                    <h:outputLabel value="Date"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 82%;
                                                     top: 7%;
                                                     font-size:12px!important;">
                                                    <h:outputLabel value=":"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 84%!important;
                                                     top: 7%!important;
                                                     font-size: 12px!important;" >                   
                                                    <h:outputLabel value="#{cc.attrs.bill.cancelledBill.billDate}"
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId ne null}"  >
                                                        <f:convertDateTime pattern="dd/MM/yy"/>
                                                    </h:outputLabel>                      
                                                    <h:outputLabel value="#{cc.attrs.bill.billDate}"
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId eq null }">
                                                        <f:convertDateTime pattern="dd/MM/yy"/>
                                                    </h:outputLabel>
                                                </div>

                                                <div style="position: absolute;
                                                     left: 0%!important;
                                                     top: 11%!important;
                                                     font-size: 12px!important;">
                                                    <h:outputLabel value="Payment Type"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 23%;
                                                     top: 11%;
                                                     font-size:12px!important;">
                                                    <h:outputLabel value=":"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 25%;
                                                     top: 11%;
                                                     font-size:12px!important;" >                     
                                                    <h:outputLabel value="#{cc.attrs.bill.cancelledBill.paymentMethod}" 
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId ne null}" />                        
                                                    <h:outputLabel value="#{cc.attrs.bill.paymentMethod}" 
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId eq null }"/>
                                                </div>

                                                <div style="position: absolute;
                                                     left: 73%!important;
                                                     top: 11%!important;
                                                     font-size: 12px!important;">
                                                    <h:outputLabel value="Time"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 82%;
                                                     top: 11%;
                                                     font-size:12px!important;">
                                                    <h:outputLabel value=":"/>
                                                </div>
                                                <div style="position: absolute;
                                                     left: 84%;
                                                     top: 11%;
                                                     font-size:12px!important;" >                                                   
                                                    <h:outputLabel value="#{cc.attrs.bill.cancelledBill.billTime}"  
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId ne null}">
                                                        <f:convertDateTime pattern="hh:mm a"/>
                                                    </h:outputLabel>                        
                                                    <h:outputLabel value="#{cc.attrs.bill.billTime}" 
                                                                   rendered="#{cc.attrs.bill.cancelledBill.insId eq null }">
                                                        <f:convertDateTime pattern="hh:mm a"/>
                                                    </h:outputLabel>
                                                </div>


                                                <h:outputLabel value="#{cc.attrs.bill.patient.person.nameWithTitle}"
                                                               styleClass="ptnamePrinting"  >
                                                </h:outputLabel>

                                                <h:outputLabel value="#{cc.attrs.bill.patient.person.phone}"
                                                               styleClass="phonePrinting" >
                                                </h:outputLabel>

                                                <h:outputLabel value="Cashier : #{cc.attrs.bill.creater.code}"
                                                               styleClass="cashierPrinting" >
                                                </h:outputLabel>

                                                <h:outputLabel value="#{cc.attrs.bill.collectingCentre.name} #{cc.attrs.bill.creditCompany.name}"
                                                               styleClass="billNamePrinting"  >
                                                </h:outputLabel>



                                                <div style="font-size: 12px!important;
                                                     position: absolute;
                                                     left: 0%;
                                                     top: 30%;">

                                                    <table>
                                                        <tr>

                                                            <td style="min-width: 4.5cm;text-align: left;background-color: blue;">
                                                                <h:outputLabel value="#{cc.attrs.bill.fromInstitution.institutionType}" rendered="#{cc.attrs.bill.fromInstitution ne null}" style="text-align: right!important;  font-size: 11px!important;   "/>
                                                                <h:outputLabel value="#{cc.attrs.bill.staff.person.name}" rendered="#{cc.attrs.bill.staff ne null}" style="text-align: right!important;  font-size: 11px!important;   "/>
                                                                <h:outputLabel value="#{cc.attrs.bill.person.name}" rendered="#{cc.attrs.bill.person ne null}" style="text-align: right!important;  font-size: 11px!important;   "/>
                                                            </td>
                                                            <td style="text-align: right!important;background-color: skyblue; ">
                                                                <h:outputLabel value="#{cc.attrs.bill.fromInstitution.name}"  style="font-weight: bold ; text-align: right!important; font-size: 11px!important;">
                                                                    <f:convertNumber pattern="#,##0.00" />
                                                                </h:outputLabel>
                                                            </td>
                                                            <td style="background-color: skyblue;min-width: 4.5cm;">
                                                                <h:outputLabel value="" style="text-align: right!important; font-size: 11px!important;"/>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <br/>
                                                                <br/>
                                                            </td>
                                                            <td>
                                                                <br/>
                                                                <br/>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="min-width: 4.5cm;text-align: left;">
                                                                <h:outputLabel value="TOTAL" style="min-width: 80%;text-align: left;font-size: 100%!important; font-weight: bold;"/>
                                                            </td>
                                                            <td style="text-align: right!important; ">
                                                                <h:outputLabel value="#{cc.attrs.bill.netTotal}"  style="min-width: 80%;text-align: left;font-size: 100%!important; font-weight: bold;" rendered="#{cc.attrs.bill.cancelledBill.insId eq null}" >
                                                                    <f:convertNumber pattern="#,##0.00" />
                                                                </h:outputLabel>
                                                                <h:outputLabel value="#{cc.attrs.bill.cancelledBill.netTotal}"  style="min-width: 80%;text-align: left;font-size: 100%!important; font-weight: bold;" rendered="#{cc.attrs.bill.cancelledBill.insId ne null}" >
                                                                    <f:convertNumber pattern="#,##0.00" />
                                                                </h:outputLabel>
                                                            </td>
                                                        </tr>



                                                    </table>

                                                </div>


                                            </div>

                                        </div>


                                    </div>
                                </div>

                            </p:panel>
                        </div>
                    </h:form>
                </div>
            </div>
        </div>


    </cc:implementation>
</html>
